package com.gzs.learn.admin.model.po;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableId;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gzs.learn.inf.annotation.Excel;
import lombok.*;

import java.io.Serializable;
import java.util.Date;

import static com.gzs.learn.inf.GlobalConstant.DATE_TIME_FORMAT;

/**
 * 数据源配置对象 db_config
 *
 * @author guanzhisong
 * @date 2021-08-12
 */
@Data
@NoArgsConstructor
@AllArgsConstructor
@EqualsAndHashCode(callSuper = false)
@Builder
public class DbConfig implements Serializable {
    private static final long serialVersionUID = 1L;

    /**
     * 主键ID
     */
    @TableId(type = IdType.AUTO)
    private Long id;

    /**
     * jdbc地址
     */
    @Excel(name = "jdbc地址")
    private String url;

    /**
     * 数据库名
     */
    @Excel(name = "数据库名")
    private String dbschema;

    /**
     * 数据库用户名
     */
    @Excel(name = "用户名")
    private String dbuser;

    /**
     * 数据库密码
     */
    @Excel(name = "密码")
    private String pwd;

    /**
     * 0启用 1禁用 2删除
     */
    @Excel(name = "状态", readConverterExp = "0=启用,1=禁用,2=删除")
    private Integer status;

    /**
     * 创建时间
     */
    @JsonFormat(pattern = DATE_TIME_FORMAT)
    private Date createTime;

    /**
     * 更新时间
     */
    @JsonFormat(pattern = DATE_TIME_FORMAT)
    @Excel(name = "更新时间", width = 30, dateFormat = DATE_TIME_FORMAT)
    private Date updateTime;
}
